using Unity.Entities;
using Unity.Mathematics;
using Unity.Physics;
using UnityEngine;

namespace Gj
{
    public enum MoveStatus
    {
        None,
        Target,
        Position,
        Direction,
        Stop,
        Teleport,
        Turn,
        Line,
    }


    public struct MoveData : IComponentData
    {
        public float3 position;
        public Entity target;
        public float3 direction;
        public float speed;
        public float distance;
        public float3 limitPosition;
        public float3 start;
        public float3 end;
        public float3 middle;
        public float progress;
        public float startTime;
        public float endTime;
        public float waitTime;
    }

    public struct MoveStatusData : IComponentData
    {
        public MoveStatus status;
        // public MoveStatus lastStatus;
    }

    public struct MoveSpeedControlData : IComponentData
    {
        public float time;
        public float _time;
        public float origin;
        public float target;
    }

    public struct MoveAmendData : IComponentData
    {
        public float3 _offsetPosition;
        public float _surplusFrameTime;
        public float _totalFrameTime;
        public float _maxFrameTime;
        public float _minFrameTime;
    }

    public struct MoveVehicleData : IComponentData
    {
        public Entity target;
        public float radius;
        public float3 last;
        public float3 prev;
    }

    public struct MoveHoldData : IComponentData
    {
        // true: 存在则不通
        // false: 存在则通
        public bool close;
        public ColliderType type;
        public float radius;
    }

    public enum LookStatus
    {
        None,
        Target,
        Position,
        Angle,
        Direction,
        Rotate,
        ForWard,
        Sync,
        Stop
    }


    public struct LookData : IComponentData
    {
        public float3 position;
        public Quaternion rotation;
        public float3 current;
        public float3 last;
        public float angle;
        public Entity target;
        public float3 direction;
        public float speed;
    }

    public struct LookStatusData : IComponentData
    {
        public LookStatus status;
        public LookStatus lastStatus;
    }

    public struct ActionFrozenData : IComponentData
    {
        public double lastTime;
    }

    public struct ActionHoldData : IComponentData
    {
        public bool auto;
    }
}